#
# Makefile for LOMBOTECH viss drivers
#

# mem2mem device, TODO: viss-m2m.o
lombo-viss-wb-dma-objs:= viss-wb-dma.o
lombo-viss-vic-objs := viss-vic.o
lombo-viss-mipi-csi-objs:= viss-mipi-csi.o
lombo-viss-vild-objs:= viss-vild.o
lombo-viss-is-objs := viss-isp.o viss-isp-preview.o
lombo-viss-objs := media-dev.o viss-m2m.o

ifeq ($(CONFIG_ARCH_LOMBO_N7V3), y)
VISS_CSP_PLATFORM := n7v3
else ifeq ($(CONFIG_ARCH_LOMBO_N7V5), y)
VISS_CSP_PLATFORM := n7v5
else ifeq ($(CONFIG_ARCH_LOMBO_N5V1), y)
VISS_CSP_PLATFORM := n5v1
else ifeq ($(CONFIG_ARCH_LOMBO_N9V1), y)
VISS_CSP_PLATFORM := n9v1
endif

SOURCE := $(srctree)/$(src)/csp/$(VISS_CSP_PLATFORM)/mipi_csi/mipi_csi_csp.c
ifneq ($(wildcard $(SOURCE)), )
lombo-viss-mipi-csi-objs += csp/$(VISS_CSP_PLATFORM)/mipi_csi/
else
lombo-viss-mipi-csi-objs += liblombo_mipi_csi.o
obj-$(CONFIG_VIDEO_LOMBO_MIPI_CSI) += liblombo_mipi_csi.o
$(obj)/liblombo_mipi_csi.o: $(src)/csp/$(VISS_CSP_PLATFORM)/mipi_csi/liblombo_mipi_csi
	cp $< $@
endif

SOURCE := $(srctree)/$(src)/csp/$(VISS_CSP_PLATFORM)/vic/vic_csp.c
ifneq ($(wildcard $(SOURCE)), )
lombo-viss-vic-objs += csp/$(VISS_CSP_PLATFORM)/vic/
else
lombo-viss-vic-objs += liblombo_vic.o
$(obj)/liblombo_vic.o: $(src)/csp/$(VISS_CSP_PLATFORM)/vic/liblombo_vic
	cp $< $@
endif

SOURCE := $(srctree)/$(src)/csp/$(VISS_CSP_PLATFORM)/isp/isp_csp.c
ifneq ($(wildcard $(SOURCE)), )
lombo-viss-is-objs += csp/$(VISS_CSP_PLATFORM)/isp/
else
lombo-viss-is-objs += liblombo_isp.o
$(obj)/liblombo_isp.o: $(src)/csp/$(VISS_CSP_PLATFORM)/isp/liblombo_isp
	cp $< $@
endif

SOURCE := $(srctree)/$(src)/csp/$(VISS_CSP_PLATFORM)/viss_top/viss_top_csp.c
ifneq ($(wildcard $(SOURCE)), )
lombo-viss-objs += csp/$(VISS_CSP_PLATFORM)/viss_top/
else
lombo-viss-objs += liblombo_viss_top.o
$(obj)/liblombo_viss_top.o: $(src)/csp/$(VISS_CSP_PLATFORM)/viss_top/liblombo_viss_top
	cp $< $@
endif

SOURCE := $(srctree)/$(src)/csp/$(VISS_CSP_PLATFORM)/vild/vild_csp.c
ifneq ($(wildcard $(SOURCE)), )
lombo-viss-vild-objs += csp/$(VISS_CSP_PLATFORM)/vild/
else
lombo-viss-vild-objs += liblombo_vild.o
$(obj)/liblombo_vild.o: $(src)/csp/$(VISS_CSP_PLATFORM)/vild/liblombo_vild
	cp $< $@
endif

SOURCE := $(srctree)/$(src)/csp/$(VISS_CSP_PLATFORM)/wb_dma/wb_dma_csp.c
ifneq ($(wildcard $(SOURCE)), )
lombo-viss-objs += csp/$(VISS_CSP_PLATFORM)/wb_dma/
else
lombo-viss-objs += liblombo_wb_dma.o
$(obj)/liblombo_wb_dma.o: $(src)/csp/$(VISS_CSP_PLATFORM)/wb_dma/liblombo_wb_dma
	cp $< $@
endif

obj-$(CONFIG_VIDEO_LOMBO_WB_DMA)	+= $(lombo-viss-wb-dma-objs)
obj-$(CONFIG_VIDEO_LOMBO_VILD)		+= $(lombo-viss-vild-objs)
obj-$(CONFIG_VIDEO_LOMBO_VIC)		+= $(lombo-viss-vic-objs)
obj-$(CONFIG_VIDEO_LOMBO_MIPI_CSI)	+= $(lombo-viss-mipi-csi-objs)
obj-$(CONFIG_VIDEO_LOMBO_ISP)		+= $(lombo-viss-is-objs)
obj-$(CONFIG_VIDEO_LOMBO_VISS)		+= $(lombo-viss-objs)

obj-$(CONFIG_VIDEO_LOMBO_CCCORE)	+= cccore/

#ccflags-y := -DDEBUG
